1. Field of the Invention
Apparatuses and methods consistent with the present invention generally relate to encoding an image and decoding an image, and more particularly, to predicting motion between screens while an image is encoded or decoded.
2. Description of the Related Art
The H.264 video compression standard, which uses more various and complex technologies than related art video compression standards, greatly enhances compressibility and image quality. For these reasons, the H.264 standard has been used to substitute for related art video compression standards and spotlighted as an application technology of digital multimedia broadcasting (DMB), digital versatile disc (DVD) technology, etc.
Motion prediction of a H.264 encoder is performed by intraprediction and interprediction. Intraprediction is a process of performing block prediction of a current picture by using a reference picture that is decoded, is deblocking filtered, and stored in a buffer. In more detail, information regarding two or more pictures is used to perform intraprediction. Interprediction is a process of performing block prediction on a decoded picture by using pixel data of blocks adjacent to a block that is to be predicted. Intraprediction and/or interprediction is performed according to properties of pictures such as I pictures, P pictures, B pictures, and the like.
Motion estimation (ME) is a process of detecting a macroblock that is most similar to a macroblock of a current frame in a previous frame by using a predetermined measured function so as to obtain a motion vector indicating a difference in traveling locations of the two macroblocks. A representative method of detecting the most similar macroblock calculates similarity between the two macroblocks by using a predetermined measuring method by moving the macroblock of the current frame on a pixel basis within a determined detection range.
The predetermined measuring method obtains absolute values of differences in values of corresponding pixels between the macroblock of the current frame and macroblocks in a detection area and determines a macroblock having the smallest value obtained by summing absolute values as the most similar macroblock.
In more detail, similarities between macroblocks of current and previous frames are determined based on a similarity value, i.e., a matching reference value, obtained by using values of pixels included in macroblocks of the current and previous frames. The matching reference value is obtained by using a predetermined measuring function that is a sum of absolute differences (SAD), a sum of absolute transformed differences (SATD), a sum of squared differences (SSD), etc.
FIG. 1A illustrates motion prediction using a P picture in the H.264/Advanced Video Coding (AVC) standard. Referring to FIG. 1A, when the P picture is a current picture 110, a reference block 105 of a reference picture 100 is used to perform ME with regard to a current block 115 of the current picture 110.
FIG. 1B illustrates motion prediction using a B picture in the H.264/AVC standard. Referring to FIG. 1B, ME with regard to the B picture is performed using different reference blocks 153 and 155 of a reference picture 150. The reference blocks 153 and 155 of the reference picture 150 are used to perform ME with regard to a current block 165 of a current picture 160. In this regard, it is necessary to encode an index of the reference blocks 153 and 155 and two motion vectors.